/**
 * Dear programmer:
 * When I wrote this code, only god and I knew how it worked.
 * Now, only god knows it!
 *
 * @author: Pegasus  Date: 2018-12-16 Time: 18:25
 *
 * 通用，底部按钮
 */

import React, {Component} from 'react';
import {
  View,
  Text,
  TouchableOpacity
} from 'react-native';
import PropTypes from 'prop-types';
import LinearGradient from "react-native-linear-gradient"
import {COLOR_HEADER_END, COLOR_HEADER_START, FONT_SIZE_TITLE} from "../../constant/PHColors"

export default class BottomButtonView extends Component {

  static propTypes = {
    title: PropTypes.string,
    onSubmitClick: PropTypes.func
  }

  static defaultProps = {}

  render(): React.ReactNode {
    return (
      <TouchableOpacity activeOpacity={0.9} onPress={this.props.onSubmitClick}>
        <LinearGradient start={{x: 0, y: 0}} end={{x: 1, y: 0}} colors={[COLOR_HEADER_START, COLOR_HEADER_END]} style={{
          height: 44,
          margin: 15,
          justifyContent: 'center',
          alignItems: 'center',
          borderRadius: 10
        }}>
          <Text style={{fontSize: FONT_SIZE_TITLE, color: '#FFF'}}>
            {this.props.title}
          </Text>
        </LinearGradient>
      </TouchableOpacity>
    )
  }

}

